package com.cskaoyan.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author stone
 * @date 2022/10/07 14:51
 */
@NoArgsConstructor
@Data
public class JsonUser {

    private String username;
    private String password;
    private long age;
    // 将String转换为Date，<del>类型转换器</del>
    // ObjectMapper.readValue(String，JsonUser.class) 👉  JsonUser
    // 转换过程中会获得birthday这个key对应的值 “1995-03-19”
    // 获得值是String，需要转换为Date，需要DateFormat
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date birthday;
}
